
package org.demoiselle.sample.view;

import javax.inject.Inject;
import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;
import org.demoiselle.sample.business.*;
import org.demoiselle.sample.domain.*;
import javax.faces.model.*;
import org.primefaces.event.TransferEvent;
import org.primefaces.model.DualListModel;
import java.util.*;

// To remove unused imports press: Ctrl+Shift+o

@ViewController
@PreviousView("./paciente_list.jsf")
public class PacienteEditMB extends AbstractEditPageBean<Paciente, Long> {

	private static final long serialVersionUID = 1L;

	@Inject
	private PacienteBC pacienteBC;
	

	public List<SelectItem> getEstado() {
		return pacienteBC.getEstado();
	}
	public List<SelectItem> getGenero() {
		return pacienteBC.getGenero();
	}
	
	@Override
	@Transactional
	public String delete() {
		this.pacienteBC.delete(getId());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String insert() {
		this.pacienteBC.insert(this.getBean());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String update() {
		this.pacienteBC.update(this.getBean());
		return getPreviousView();
	}
	
	@Override
	protected Paciente handleLoad(Long id) {
		return this.pacienteBC.load(id);
	}	
}